import { jsx as _jsx } from "react/jsx-runtime";
import { CheckOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd-v4';
import classNames from 'classnames';
import { useMemo } from 'react';

var BlockCheckbox = function BlockCheckbox(_ref) {
  var value = _ref.value,
      configType = _ref.configType,
      onChange = _ref.onChange,
      list = _ref.list,
      prefixCls = _ref.prefixCls;
  var baseClassName = "".concat(prefixCls, "-drawer-block-checkbox");
  var dom = useMemo(function () {
    var domList = (list || []).map(function (item) {
      return _jsx(Tooltip, {
        title: item.title,
        children: _jsx("div", {
          className: classNames("".concat(baseClassName, "-item"), "".concat(baseClassName, "-item-").concat(item.key), "".concat(baseClassName, "-").concat(configType, "-item")),
          onClick: function onClick() {
            return onChange(item.key);
          },
          children: _jsx(CheckOutlined, {
            className: "".concat(baseClassName, "-selectIcon"),
            style: {
              display: value === item.key ? 'block' : 'none'
            }
          })
        })
      }, item.key);
    });
    return domList; // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [value, list === null || list === void 0 ? void 0 : list.length, onChange]);
  return _jsx("div", {
    className: baseClassName,
    style: {
      minHeight: 42
    },
    children: dom
  });
};

export default BlockCheckbox;